<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>TODO</title>
    <link rel="stylesheet" href="./TODO.css">
</head>

<body>
    <div id="todo">
        <h2>剩余待办：{{todoTotal}}条</h2>
        <div class="todo-input">
            <input type="text" v-model.trim="todoNew">
            <button @click="todoAdd">添加</button>
        </div>
        <div class="todo-input">
            <input type="text" v-model.trim="searchText" @keyup.enter="search(searchText)" placeholder="回车查找" >
            <button @click="search(searchText)">查找</button>
        </div>
        <ul>
            <li v-for="(todo,index) in todoList" :key="index">
                <input v-model='todo.Checked' type="checkbox" >
                <input v-model='todo.Text' type="text" v-if="todo.Editable"  >
                <label v-else :class="{completed:todo.Checked}" >{{todo.Text|toUpper}}</label>
                <button @click='editTodo(todo)' v-if="!todo.Editable">编辑</button>
                 <button v-else @click='saveTodo(todo)'>保存</button>
                <button :disabled='todo.Editable' @click='todoRemove(todo)'>删除</button>
            </li>
        </ul>
    </div>
       <script src="./vue.js"></script>
    <script src="./TODO.js"></script>
</body>

</html>
